// 防抖
export function debounce(fn, delay) {
  let timer = null
  return function () {
    let _this = this
    let args = arguments
    if (timer) clearTimeout(timer)
    timer = setTimeout(function () {
      fn.apply(_this, args)
    }, delay)
  }
}

// 修改平台ico
export function changeIco(link) {
  let $favicon = document.querySelector('link[rel="icon"]')
  if ($favicon !== null) {
    $favicon.href = link
  } else {
    $favicon = document.createElement('link')
    $favicon.rel = 'icon'
    $favicon.href = link
    document.head.appendChild($favicon)
  }
}
